package contratosonline.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "termoaditivo", schema = "contratos")
@NamedQueries({@NamedQuery(name = "Termoaditivo.findAll", query = "SELECT t FROM TermoAditivo t"), @NamedQuery(name = "Termoaditivo.findByIdTermoAditivo", query = "SELECT t FROM TermoAditivo t WHERE t.idTermoAditivo = :idTermoAditivo"), @NamedQuery(name = "Termoaditivo.findByDataAssinatura", query = "SELECT t FROM TermoAditivo t WHERE t.dataAssinatura = :dataAssinatura"), @NamedQuery(name = "Termoaditivo.findByDataFinalVigencia", query = "SELECT t FROM TermoAditivo t WHERE t.dataFinalVigencia = :dataFinalVigencia"), @NamedQuery(name = "Termoaditivo.findByTipoTermo", query = "SELECT t FROM TermoAditivo t WHERE t.tipoTermo = :tipoTermo"), @NamedQuery(name = "Termoaditivo.findByNumeroTermo", query = "SELECT t FROM TermoAditivo t WHERE t.numeroTermo = :numeroTermo")})
public class TermoAditivo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "idTermoAditivo")
    private Integer idTermoAditivo;
    @Basic(optional = false)
    @Column(name = "dataAssinatura")
    @Temporal(TemporalType.DATE)
    private Date dataAssinatura;
    @Basic(optional = false)
    @Column(name = "dataFinalVigencia")
    @Temporal(TemporalType.DATE)
    private Date dataFinalVigencia;
    @Basic(optional = false)
    @Column(name = "tipoTermo")
    private String tipoTermo;
    @Basic(optional = false)
    @Column(name = "numeroTermo")
    private int numeroTermo;
    @JoinColumn(name = "contrato", referencedColumnName = "idcontrato")
    @ManyToOne(fetch = FetchType.EAGER)
    private Contrato contrato;

    public TermoAditivo() {
    }

    public TermoAditivo(Integer idTermoAditivo) {
        this.idTermoAditivo = idTermoAditivo;
    }

    public TermoAditivo(Integer idTermoAditivo, Date dataAssinatura, Date dataFinalVigencia, String tipoTermo, int numeroTermo) {
        this.idTermoAditivo = idTermoAditivo;
        this.dataAssinatura = dataAssinatura;
        this.dataFinalVigencia = dataFinalVigencia;
        this.tipoTermo = tipoTermo;
        this.numeroTermo = numeroTermo;
    }

    public Integer getIdTermoAditivo() {
        return idTermoAditivo;
    }

    public void setIdTermoAditivo(Integer idTermoAditivo) {
        this.idTermoAditivo = idTermoAditivo;
    }

    public Date getDataAssinatura() {
        return dataAssinatura;
    }

    public void setDataAssinatura(Date dataAssinatura) {
        this.dataAssinatura = dataAssinatura;
    }

    public Date getDataFinalVigencia() {
        return dataFinalVigencia;
    }

    public void setDataFinalVigencia(Date dataFinalVigencia) {
        this.dataFinalVigencia = dataFinalVigencia;
    }

    public String getTipoTermo() {
        return tipoTermo;
    }

    public void setTipoTermo(String tipoTermo) {
        this.tipoTermo = tipoTermo;
    }

    public int getNumeroTermo() {
        return numeroTermo;
    }

    public void setNumeroTermo(int numeroTermo) {
        this.numeroTermo = numeroTermo;
    }

    public Contrato getContrato() {
        return contrato;
    }

    public void setContrato(Contrato contrato) {
        this.contrato = contrato;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTermoAditivo != null ? idTermoAditivo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TermoAditivo)) {
            return false;
        }
        TermoAditivo other = (TermoAditivo) object;
        if ((this.idTermoAditivo == null && other.idTermoAditivo != null) || (this.idTermoAditivo != null && !this.idTermoAditivo.equals(other.idTermoAditivo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "contratosonline.entity.TermoAditivo[idTermoAditivo=" + idTermoAditivo + "]";
    }

}
